home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
vbtime1a
/
timer.ctl
< prev
next >
Wrap
Text File
|
1999-08-31
|
3KB
|
101 lines
VERSION 5.00
Begin VB.UserControl Timer
ClientHeight = 615
ClientLeft = 0
ClientTop = 0
ClientWidth = 765
InvisibleAtRuntime= -1 'True
ScaleHeight = 615
ScaleWidth = 765
ToolboxBitmap = "Timer.ctx":0000
Begin VB.Image IDIMG_Timer
Height = 420
Left = 0
Picture = "Timer.ctx":0312
Top = 0
Width = 420
End
End
Attribute VB_Name = "Timer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Public Event Timer()
Dim WithEvents timerObjLocal As CTimer
Attribute timerObjLocal.VB_VarHelpID = -1
Public Enum PriorityClass
Normal = &H20
Low = &H40
High = &H80
RealTime = &H100
End Enum
Private Sub timerObjLocal_MVtimer()
RaiseEvent Timer
End Sub
Private Sub UserControl_Initialize()
Set timerObjLocal = New CTimer
Set timerObj = timerObjLocal
End Sub
Private Sub UserControl_InitProperties()
Enabled = False
Interval = 1000
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Interval = PropBag.ReadProperty("Interval", 0)
Enabled = PropBag.ReadProperty("Enabled", False)
ProcessPriority = PropBag.ReadProperty("ProcessPriority", Normal)
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "Interval", Interval, 0
PropBag.WriteProperty "Enabled", Enabled, False
PropBag.WriteProperty "ProcessPriority", ProcessPriority, Normal
End Sub
Private Sub UserControl_Resize()
UserControl.Width = IDIMG_Timer.Width
UserControl.Height = IDIMG_Timer.Height
End Sub
Private Sub UserControl_Terminate()
Enabled = False
End Sub
Public Property Let Enabled(enable As Boolean)
If enable = True Then
lngTimerID = SetTimer(0, 0, intervalSet, AddressOf TimerProc)
Else
lngTimerID = KillTimer(0, lngTimerID)
lngTimerID = 0
End If
End Property
Public Property Get Enabled() As Boolean
If lngTimerID = 0 Then
Enabled = False
Else
Enabled = True
End If
End Property
Public Property Let Interval(value As Long)
If value > 2147483646 Then
Call MsgBox("Maximum value of 2,147,483,647 (24.8 Days)!", vbOKOnly + vbCritical, "Over Maximum")
Exit Property
End If
If lngTimerID <> 0 Then
Enabled = False
intervalSet = value
Enabled = True
Else
intervalSet = value
End If
End Property
Public Property Get Interval() As Long
Interval = intervalSet
End Property
Public Property Let ProcessPriority(priorityValue As PriorityClass)
priority = priorityValue
End Property
Public Property Get ProcessPriority() As PriorityClass
ProcessPriority = priority
End Property